package com.starter.home.util;

import lombok.Data;

/**
 * 返回的类
 *
 * @author jian.li
 * @date 2019年 12月13日 14:20:36
 */
@Data
public class ResponseResult {

    private boolean result;

    private String code;

    private String message;

    private Object data;

    private ResponseResult() {
    }

    public static ResponseResult success(Object data){
        ResponseResult responseResult = new ResponseResult();
        responseResult.setResult(true);
        responseResult.setCode("200");
        responseResult.setMessage("成功");
        responseResult.setData(data);
        return responseResult;
    }
    public static ResponseResult error(String message){
        ResponseResult responseResult = new ResponseResult();
        responseResult.setResult(false);
        responseResult.setCode("500");
        responseResult.setMessage(message);
        return responseResult;
    }

    public static ResponseResult of(boolean result,String code,String message,Object data){
        ResponseResult responseResult = new ResponseResult();
        responseResult.setResult(result);
        responseResult.setCode(code);
        responseResult.setMessage(message);
        responseResult.setData(data);
        return responseResult;
    }


}
